package yedean.bean;

import com.yedean.factory.BeansException;
import com.yedean.factory.FactoryBean;
import com.yedean.factory.ObjectFactory;

import java.lang.reflect.Proxy;

public class HusbandMother implements FactoryBean<IMother> {
    @Override
    public IMother getObject() throws BeansException {
        return (IMother) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[]{IMother.class},
                ((proxy, method, args) -> "婚后媳妇妈妈的职责被代理了!"+method.getName()));
    }

    @Override
    public Class<?> getObjectType() {
        return IMother.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
